can't load big files to server with php [closed]

Posted by yozhik on Pro Webmasters See other posts from Pro Webmasters or by yozhik
Published on 2010-12-26T12:57:06Z Indexed on 2010/12/28 1:01 UTC
Read the original article Hit count: 570

Filed under:
|

Hi all! I can't load big files to server. The problem is in that file $_FILES["filename"]["tmp_name"] is empty if file a little more bigger then 2mb. I tried to change variables in php.ini

upload_max_filesize = 700M

post_max_size = 16M

but not working to. Also tried to add this variables to my .httaccess file - but 500 error appears.

Error code while uploading=1.
UPLOAD_ERR_INI_SIZE 

Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

Here is my uppload.php page, please anwer what I doing wrong? Thanx!

<?php
    if(strlen($_FILES["filename"]["name"]))
    {
        $folder = "uploads/";
        echo $folder;
        $error = "";
        if($_FILES["filename"]["size"] > 1024*700*1024)
        {
            $error .= "<b><p class=ErrorMessage>?????? ????? ????????? 5Mb</p></b><br>";
            header("Location: upload.php?error=".$error, true, 303 );
        }
        if(!file_exists($folder.="hh/"))
        {
            if(!mkdir($folder, 0700))
                $error .= "<b><p class=ErrorMessage>Folder not created</p></b><br>";
        }
        //echo "<br>".$_FILES["filename"]["tmp_name"]."<br>";
        echo $folder.$_FILES["filename"]["name"]."<br>";
        echo $_FILES["filename"]["error"]."<br>";
        if(move_uploaded_file($_FILES["filename"]["tmp_name"], $folder.$_FILES["filename"]["name"]))
        {
            echo("???? ??????? ???????? <br>");
            echo("?????????????? ?????: <br>");
            echo("??? ?????: ");
            echo($_FILES["filename"]["name"]);
            echo("<br>?????? ?????: ");
            echo($_FILES["filename"]["size"]);
            echo("<br>??????? ??? ????????: ");
            echo($folder.=$_FILES["filename"]["name"]);
            echo("<br>??? ?????: ");
            echo($_FILES["filename"]["type"]);
        } 
        else 
        {
            $error .= "<b><p class=ErrorMessage>?????? ???????? ?????</p></b><br>";
        }
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>???????? ??? ????????</title>
</head>

<body>
        <?php 
            if(isset($_REQUEST["error"]))
            {
                echo $_REQUEST["error"];    
            }
        ?>
      <h2><p><b> ????? ??? ???????? ?????? </b></p></h2>
      <form action="upload.php" method="post" enctype="multipart/form-data">
      <input type="file" name="filename" READONLY><br> 
      <input name="Upload" type="submit" value="Upload"><br>
      </form>


</body>

</html>

© Pro Webmasters or respective owner

Related posts about php

Related posts about uploading